using System;

namespace Gurucore.Framework.DataAccess.Persistence.QueryLanguage
{
	public abstract class Operator
	{
		public static PreUnaryOperator ValueOf = new PreUnaryOperator("ValueOf", string.Empty);

		public static BinaryOperator Add = new BinaryOperator("Add", "+");
		public static BinaryOperator Sub = new BinaryOperator("Sub", "-");
		public static BinaryOperator Mul = new BinaryOperator("Mul", "*");
		public static BinaryOperator Div = new BinaryOperator("Div", "/");

		public static PreUnaryOperator Neg = new PreUnaryOperator("Neg", "-");

		public static BinaryOperator And = new BinaryOperator("And", "AND");
		public static BinaryOperator Or = new BinaryOperator("Or", "OR");
		public static BinaryOperator Xor = new BinaryOperator("Xor", "XOR");
		public static PreUnaryOperator Not = new PreUnaryOperator("Not", "NOT");

		public static BinaryOperator Like = new BinaryOperator("Like", "LIKE");
		public static SetOperator In = new SetOperator("In", "IN");
		public static SetOperator NotIn = new SetOperator("NotIn", "NOT IN");
		public static RangeOperator Between = new RangeOperator("Between", "BETWEEN");

		public static BinaryOperator Gt = new BinaryOperator("Gt", ">");
		public static BinaryOperator Lt = new BinaryOperator("Lt", "<");
		public static BinaryOperator Eq = new BinaryOperator("Eq", "=");
		public static BinaryOperator Neq = new BinaryOperator("Neq", "<>");
		public static BinaryOperator Gte = new BinaryOperator("Gte", ">=");
		public static BinaryOperator Lte = new BinaryOperator("Lte", "<=");

		public static PostUnaryOperator IsNull = new PostUnaryOperator("IsNull", "IS NULL");
		public static PostUnaryOperator IsNotNull = new PostUnaryOperator("IsNotNull", "IS NOT NULL");

		private string m_sName;
		private string m_sSignature;

		protected Operator(string p_sName, string p_sSignature)
		{
			m_sName = p_sName;
			m_sSignature = p_sSignature;
		}

		public override string ToString()
		{
			return m_sSignature;
		}

		public abstract bool IsUnary();
	}
}
